#ifndef MONSTER_H
#define MONSTER_H


#include "GameOpt.h"

//#include "Entity.h"
//#include "Maze.h"

class Monster : public Entity, SaveLoad
{
public:
	Monster(const char = '0', Point  = Point(1,1),  
			   unsigned int = 0, unsigned int = 0, 
			   unsigned int = 0, unsigned int = 0,
			   unsigned int = 0, unsigned int = 0,
			   double = 3, double = 1);
	virtual ~Monster();
	virtual Point reqMove(Maze &); // set visible range,empty stack,find closest possible option
	virtual char kind() const; // Pure Virtual Function
	bool setVisibility(double);
	int initPath(Maze &);
	virtual unsigned int incExperience(unsigned int iExp)
	{
		return iExp; //Monster Does not have Exp
	}

	virtual bool SaveState(ofstream &);
	virtual bool LoadState(ifstream &);
private:
	// returns all possible paths to target,
	// the vector is sorted by stack(path) size
	// recursive!!!
	int Search(char,vector<Point>, Point ,const bool[50][24], Maze &, vector<stack<char>> &); 
	// service routine for  Search
	bool wasHere(vector<Point> &, Point &); //was I here?
	// translates a vector of points to a stack of movement instructions
	stack <char> Route2Path(vector<Point> &);
	int getVrange(Maze & GameMaze);
	// Strike out visible range, returns number of changes
	int StrikeOut(Point &,const int ,const int); // Strike out visible range, returns number of changes
	bool IsVisible(Point &,const double,const double,Point) const;
	double dVisibility;
	double dBrains; // how smart is the monster 0(stupid) to 1(smart)
//	bool ** Vrange;	// Visible range of the map for a monster
	bool Vrange[MAZE_SIZE_X][MAZE_SIZE_Y];
	vector<stack<char>> Paths;
	stack<char> Path;
};

// Comarison element for algorithm::sort
struct StackCompare
{
	bool operator()(const stack<char> & a,const stack<char> & b) const
	{
		return a.size()<b.size();
	}
};

#endif
